# This code is part of the MWP System
# Copyright (c) 2012 Benjamin Lubin (blubin@bu.com) 
# Published under and subject to the GPLv2 license available at http://www.gnu.org/licenses/gpl-2.0.html

'''
Created on Dec 14, 2012
@author: blubin
'''

from frontend.roleApplication import RoleApplication;
from frontend.form import Type;
from unique import UNIQUE;

class SubcontractorApplication(RoleApplication):
    """ The Subcontractor User Interface """

    def __init__(self):
        super(SubcontractorApplication, self).__init__("construction"+UNIQUE, "Subcontractor");
        self.register_transition_step("ExecuteSubcontract", self.sub_job_form_creator);

    def sub_job_form_creator(self, stepname, form):
        form.add_html_label('<B>Enter Sub-Contractor and Project Information</B>')
        form.add_field(Type.SHORTSTRING, "SubName", labeltext="Contractor Name", initial="John Wayne");
        form.add_field(Type.SHORTSTRING, "CompName", labeltext="Company Name", initial="Bricks Inc.");
        form.add_field(Type.SHORTSTRING, "ProjectName", labeltext="Project", initial="Building X");
        form.add_field(Type.CHOICE, "JobType", labeltext="Job Type", choices=['Electrical', 'Plumbing', 'Framing', 'Alarm', 'Landscaping', 'Decorating', 'Installing', 'Finishing', 'Heating/AC', 'Carpentry', 'Bricklaying',  'Welding', 'Foundations'], initial='Electrical');
        form.add_field(Type.DATE, "Project Start Date");
        form.add_field(Type.DATE, "Project End Date");
        form.add_field(Type.INTEGER, "TotalHours", labeltext="Total Job Hours", initial=1);
        form.add_field(Type.CURRENCY, "ExtraExp", labeltext="Additional Job Expenses", initial=0);
        form.add_field(Type.CHOICE, "JobStatus", labeltext="Job Complete?", choices=['YES', 'NO', 'IN PROGRESS'], initial='NO');
    
if __name__ == '__main__':
    app = SubcontractorApplication();
    app.MainLoop();